﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace MaterialEditor
{
    public partial class VectorPicker : Form
    {
        public bool _3dVector;

        /// <summary>
        /// Creates a new instance of vector picker
        /// </summary>
        /// <param name="_3dVector">If true, enables the user to modify a z value</param>
        public VectorPicker(bool _3dVector, Nullable<Microsoft.Xna.Framework.Vector3> existing = null)
        {
            InitializeComponent();

            this._3dVector = _3dVector;
            if (!_3dVector)
            {
                zValue.Enabled = false;
                label3.Enabled = false;
            }

            if (existing.HasValue)
            {
                xValue.Value = (decimal)existing.Value.X;
                yValue.Value = (decimal)existing.Value.Y;
                if (_3dVector)
                    zValue.Value = (decimal)existing.Value.Z;
            }
        }

        private void okButton_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.Close();
        }
    }
}
